<?php
require '../../config.php';
if (isset($_REQUEST['idplan'])) 
	$codigoplan = $_REQUEST['idplan']; 
$query="SELECT c.idclientes,c.nombres,c.apellidos,c.cedula from clientes c, planes p
where p.idplanes = '".$codigoplan."'
and (c.idruta = p.idruta)
and idclientes NOT IN (SELECT cliente FROM clientespendientes where plan = '".$codigoplan."')";
$resultset = mysql_query($query,$conexion);
	
	echo "<input type='text' class='form-control' size='60' id = 'obsmodal' placeholder='Observaci&oacute;n...' >";
	echo "<legend>Estado de los clientes:</legend>";
	echo   "<table class='table table-bordered'>";
	echo   "<tr>";
	echo   "<th>Identificador</th><th>Cliente</th><th>C&eacute;dula</th><th>Estado</th>";
	echo   "</tr>";
	echo   "<tbody>";
	$aux=0;
	while($row = mysql_fetch_assoc($resultset))
	{
		echo   "<tr  class='success'>";
		if($aux==0){
			$color="#FFFFFF";
			$aux=1;
		}else{
			$color="#F9F9F9";
			$aux=0;
		}
		echo   "<td>".$row['idclientes']."</td>";
		echo   "<td>".$row['nombres']." ".$row['apellidos']."</td>";
		echo   "<td>".$row['cedula']."</td>";
		echo   "<td><a  href='#' <span class='glyphicon glyphicon-thumbs-up'   onclick='cambiarefectividad(". $row['idclientes'] .",1,".$codigoplan.")'></span></a></td>";
		echo   "</tr>";
	}
	
	$query="SELECT c.idclientes,c.nombres,c.apellidos,c.cedula from clientes c, planes p
	where p.idplanes = '".$codigoplan."'
	and (c.idruta = p.idruta)
	and idclientes IN (SELECT cliente FROM clientespendientes where plan = '".$codigoplan."')";
	$resultset2 = mysql_query($query,$conexion);
	while($row = mysql_fetch_assoc($resultset2))
	{
		echo   "<tr  class='danger'>";
		if($aux==0){
			$color="#FFFFFF";
			$aux=1;
		}else{
			$color="#F9F9F9";
			$aux=0;
		}
		echo   "<td>".$row['idclientes']."</td>";
		echo   "<td>".$row['nombres']." ".$row['apellidos']."</td>";
		echo   "<td>".$row['cedula']."</td>";
		echo   "<td><a  href='#' <span class='glyphicon glyphicon-thumbs-down'   onclick='cambiarefectividad(". $row['idclientes'] .",2,".$codigoplan.")'></span></a></td>";
		echo   "</tr>";
	}
	echo   "</tbody>";
	echo   "</table>";
	mysql_close();
?>